<?php
namespace addon\cms\validate;
use app\common\validate\ValidateBase;
class MiniModule extends ValidateBase
{
    // 验证规则
    protected $rule = [
        'id'                        => 'require|gt:0',
        'title'                     => 'require',
        'more_url'                  => 'require',
        'base_url'                  => 'require',
        'limit'                     => 'require|gt:0',
        'style'                     => 'require|in:1,2,3',
        'category_id'               => 'require|gt:0',
        'sort'                      => 'require',
    ];

    // 验证提示
    protected $message = [
        'id.require'            => '非法操作',
        'id.gt'                 =>'非法ID',
        'title.require'         => '模块名称必须',
        'more_url.require'        => '模块列表地址必须',
        'base_url.require'        => '模块详情地址必须',
        'limit.require'         => '首页展示数量必须',
        'limit.gt'              =>'首页展示数量必须大于0',
        'style.require'         => '展示样式必须',
        'style.in'              => '展示样式非法',
        'category_id.require'         => '分类ID必须',
        'category_id.gt'              =>'分类ID必须大于0',
        'sort.require'        => '排序方式',
    ];

    // 应用场景
    protected $scene = [
        'edit'  =>  ['title','more_url','base_url','limit','style','category_id','sort'],
    ];
}